# AVR-GCC Makefile
PROJECT=lednumber
SOURCES=led_number_display.c ../common/common.c
CC=avr-gcc
OBJCOPY=avr-objcopy
MMCU=atmega128

CFLAGS=-mmcu=$(MMCU) -Wall

# -j .data is needed to get local statics to work.
$(PROJECT).hex: $(PROJECT).out
	$(OBJCOPY) -j .text -j .data  -O ihex $(PROJECT).out $(PROJECT).hex

$(PROJECT).out: $(SOURCES)
	$(CC) $(CFLAGS) -I./ -o $(PROJECT).out $(SOURCES)

program: $(PROJECT).hex
	avrdude -c usbasp -p m128 -U flash:w:$(PROJECT).hex

clean:
	rm -f $(PROJECT).out
	rm -f $(PROJECT).hex

